document.addEventListener('DOMContentLoaded',function() {//打开页面插入js
    jsPath = "js/inject.js";
    var tmp = document.createElement('script');
    tmp.src = chrome.extension.getURL(jsPath);
    tmp.setAttribute('type','text/javascript');
    document.head.appendChild(tmp);
});

window.addEventListener("message", function(e)
{
    // alert(e.data)
    console.log(typeof(e.data))
    if (typeof(e.data) == 'object' && (e.data.type == 'receive' ||e.data.type == 'send')){
        console.log('1321231',e.data.text)
        chrome.runtime.sendMessage(e.data, function(response) {
            console.log();
        });
    }
}, false);